function checkId(pId) {
	//检查身份证号码
	var arrVerifyCode = [ 1, 0, "x", 9, 8, 7, 6, 5, 4, 3, 2 ];
	var Wi = [ 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 ];
	var Checker = [ 1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1 ];
	if (pId.length != 15 && pId.length != 18) {
		//return "身份证号共有15位或18位"
		alert("身份证号共有15位或18位")
		return
	}
	var Ai = pId.length == 18 ? pId.substring(0, 17) : pId.slice(0, 6) + "19" + pId.slice(6, 16);
	if (!/^\d+$/.test(Ai)) {
		//return "身份证除最后一位外，必须为数字！"
		alert("身份证除最后一位外，必须为数字！")
		return
	}
	var yyyy = Ai.slice(6, 10),
		mm = Ai.slice(10, 12) - 1,
		dd = Ai.slice(12, 14);
	//	alert("yyyy=="+yyyy);
	var d = new Date(yyyy, mm, dd),
		now = new Date();
	//	alert("d=="+d);
	var year = d.getFullYear(),
		mon = d.getMonth(),
		day = d.getDate();
	if (year != yyyy || mon != mm || day != dd || d > now || year < 1800) {
		//return "身份证输入错误！"
		alert("身份证格式错误,请重新输入！")
		return
	}

	for (var i = 0, ret = 0; i < 17; i++) {
		ret += Ai.charAt(i) * Wi[i]
	}
	Ai += arrVerifyCode[ret %= 11];
	//	alert("Ai=="+Ai);
	//  return pId.length == 18 && pId != Ai ? alert("身份证格式错误！") : Ai;
	return pId.length == 18 && pId != Ai ? pId : pId;

}
function getInfo() {
	//获取输入身份证号码
	var ic = $("#IDcard").val();
	ic = checkId(ic);
	if (isNaN(ic)) return;
	var ic = String(ic);
	//获取出生日期
	var birth = ic.substring(6, 10) + "-" + ic.substring(10, 12) + "-" + ic.substring(12, 14);
	$("#birthday").val(birth);
	//	alert("birth=="+birth);
	//获取性别
	var gender = ic.slice(14, 17) % 2 ? "1" : "2"; // 1代表男性，2代表女性
	gender === "1" ? $("#sex").val("男") : $("#sex").val("女")
	//	alert("gender=="+gender);
	/*var sexOption = document.getElementsByName("rabSex");
	 for(var i = 0; i < sexOption.length; i++) {
	 if(sexOption[i].value == gender) {
	 sexOption[i].checked = true;
	 break;
	 }
	 }*/
	//获取年龄
	var myDate = new Date();
	var month = myDate.getMonth() + 1;
	var day = myDate.getDate();
	var age = myDate.getFullYear() - ic.substring(6, 10) - 1;
	if (ic.substring(10, 12) < month || ic.substring(10, 12) == month && ic.substring(12, 14) <= day) {
		age++;
	}
	$("#age").val(age);
//	alert("age=="+age);
}